package br.edu.fasete.javaroad.plugin.gui.tablemodel;

import java.util.Vector;
import javax.swing.table.DefaultTableModel;

import br.edu.fasete.javaroad.model.EntityDescriptor;

public class ClassListTableModel extends DefaultTableModel {
	private static String[] colunas = {"Classe"};
	private Class[] classes = {EntityDescriptor.class};
	
	public ClassListTableModel() {
		super(colunas, 0);
	}
	
	public String getColumnName(int arg0) {
		return colunas[arg0];
	}

	public Class getColumnClass(int arg0) {
		return classes[arg0];
	}
	
	public void adicionarClasse(EntityDescriptor cls) {
		Vector linha = new Vector();
		linha.add(cls);
		super.addRow(linha);
	}
	
	public void limparTabela() {
		while(this.getRowCount() > 0) {
			this.removeRow(0);
		}
	}
	
	public EntityDescriptor getClassAt(int row) {
		return (EntityDescriptor) this.getValueAt(row, 0);
	}
	

}
